<?php echo $css_tree;?>
<style type="text/css">
<!--
.pad10{width:300px;height:300px;overflow:auto;}
-->
</style>
<div class="pad10">
<div class="table-list" id="load_priv">	
	<form method="post" action="__GROUP__/Setting/dosetpriv" id="myform" name="myform">
		<table id="dnd-example" class="treeTable" width="100%" cellspacing="0">
			<tbody>
				<?php echo $categorys;?>
			</tbody>
		</table>
		<input type="hidden" name="role_id" value="{$role_id}" />
		<input type="submit" class="dialog" value="提交" id="dosubmit" name="dosubmit" />
	</form>
	</div>
	</div>
<?php echo $js_tree;?>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
  $("#dnd-example").treeTable({
  	indent: 20
  	});
});
function checknode(obj)
{
    var chk = $("input[type='checkbox']");
    var count = chk.length;
    var num = chk.index(obj);
    var level_top = level_bottom =  chk.eq(num).attr('level');
    for (var i=num; i>=0; i--)
    {
            var le = chk.eq(i).attr('level');
            if(eval(le) < eval(level_top)) 
            {
                chk.eq(i).attr("checked",'checked');
                var level_top = level_top-1;
            }
    }
    for (var j=num+1; j<count; j++)
    {
            var le = chk.eq(j).attr('level');
            if(chk.eq(num).attr("checked")=='checked') {
                if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",'checked');
                else if(eval(le) == eval(level_bottom)) break;
            }
            else {
                if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",false);
                else if(eval(le) == eval(level_bottom)) break;
            }
    }
	
}
//]]>
</script>